﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SCG.General
{
    public class RandomList<T> : List<T>
    {
        public T RandomValue
        {
            get
            {
                return this[_rnd.Next(Count)];
            }
        }

        public T RemoveRandomValue
        {
            get
            {
                int idx = _rnd.Next(Count);
                T value = this[idx];
                RemoveAt(idx);
                return value;
            }
        }

        private static Random _rnd = new Random();
    }
}
